package com.lyd.mybatis.demo.api.controller.v1;

import com.lyd.mybatis.demo.app.model.dto.UserDTO;
import com.lyd.mybatis.demo.app.model.dto.UserQueryDTO;
import com.lyd.mybatis.demo.app.model.vo.UserVO;
import com.lyd.mybatis.demo.app.service.UserService;
import com.lyd.sweet.web.controller.AbstractBasicController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * File UserController
 */
@Api(tags = "扩展与重写方法操作测试")
@RestController
@RequestMapping(value = "/users")
public class UserController extends AbstractBasicController<UserQueryDTO, UserDTO, UserVO> {

    private final UserService userService;

    public UserController(UserService userService) {
        super(userService);
        this.userService = userService;
    }

    @ApiOperation("禁用用户")
    @GetMapping("/{id}/disabled")
    public Boolean disabled(@PathVariable Long id){
        return this.userService.disabled(id);
    }

    @ApiOperation("启用用户")
    @GetMapping("/{id}/enabled")
    public Boolean enabled(@PathVariable Long id){
        return this.userService.enabled(id);
    }
}
